package com.situ.vivamarket.model;

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class Address {
    private Integer id;
    private String name;
    private Integer parentId;
    private Address parent;//关联父地址

    //获取完整地址名
    public String getFullName() {
        Address parent = getParent();//延迟加载需要有get方法才能触发，属性触发不了
        if (parent != null) {
            return parent.getFullName() + name;
        } else {
            return name;
        }
    }
}
